home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / amiga / plotting / gnuplot3.lzh / gnuplot / term / tek.trm < prev    next >
Encoding:
Text File  |  1991-06-18  |  6.6 KB  |  360 lines

  1. /* GNUPLOT - tek.trm */
  2. /*
  3.  * Copyright (C) 1990   
  4.  *
  5.  * Permission to use, copy, and distribute this software and its
  6.  * documentation for any purpose with or without fee is hereby granted, 
  7.  * provided that the above copyright notice appear in all copies and 
  8.  * that both that copyright notice and this permission notice appear 
  9.  * in supporting documentation.
  10.  *
  11.  * Permission to modify the software is granted, but not the right to
  12.  * distribute the modified code.  Modifications are to be distributed 
  13.  * as patches to released version.
  14.  *  
  15.  * This software  is provided "as is" without express or implied warranty.
  16.  * 
  17.  * This file is included by ../term.c.
  18.  *
  19.  * This terminal driver supports:
  20.  *  tek40xx, bitgraph, kermit_color_tek40xx, kermit_mono_tek40xx, selanar
  21.  *  ln03plus
  22.  *
  23.  * AUTHORS
  24.  *   Colin Kelley, Thomas Williams, Russell Lang
  25.  * 
  26.  * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  27.  * 
  28.  */
  29.  
  30. #ifdef TEK
  31.  
  32. #define TEK40XMAX 1024
  33. #define TEK40YMAX 780
  34.  
  35. #define TEK40XLAST (TEK40XMAX - 1)
  36. #define TEK40YLAST (TEK40YMAX - 1)
  37.  
  38. #define TEK40VCHAR        25
  39. #define TEK40HCHAR        14
  40. #define TEK40VTIC        11
  41. #define TEK40HTIC        11    
  42.  
  43. #define HX 0x20        /* bit pattern to OR over 5-bit data */
  44. #define HY 0x20
  45. #define LX 0x40
  46. #define LY 0x60
  47.  
  48. #define LOWER5 31
  49. #define UPPER5 (31<<5)
  50.  
  51.  
  52. TEK40init()
  53. {
  54. }
  55.  
  56.  
  57. TEK40graphics()
  58. {
  59. #ifdef vms
  60.     term_pasthru();
  61. #endif /* vms */
  62.     fprintf(outfile,"\033\014");
  63. /*                   1
  64.     1. clear screen
  65. */
  66.     (void) fflush(outfile);
  67.     sleep(1);  
  68.     /* sleep 1 second to allow screen time to clear on real 
  69.        tektronix terminals */
  70. }
  71.  
  72. TEK40text()
  73. {
  74.     TEK40move(0,12);
  75.     fprintf(outfile,"\037");
  76. /*                   1
  77.     1. into alphanumerics
  78. */
  79. #ifdef vms
  80.     term_nopasthru();
  81. #endif /* vms */
  82. }
  83.  
  84.  
  85. TEK40linetype(linetype)
  86. int linetype;
  87. {
  88. }
  89.  
  90. TEK40move(x,y)
  91. unsigned int x,y;
  92. {
  93.     (void) putc('\035', outfile);    /* into graphics */
  94.     TEK40vector(x,y);
  95. }
  96.  
  97.  
  98. TEK40vector(x,y)
  99. unsigned int x,y;
  100. {
  101.     (void) putc((HY | (y & UPPER5)>>5), outfile);
  102.     (void) putc((LY | (y & LOWER5)), outfile);
  103.     (void) putc((HX | (x & UPPER5)>>5), outfile);
  104.     (void) putc((LX | (x & LOWER5)), outfile);
  105. }
  106.  
  107.  
  108. TEK40put_text(x,y,str)
  109. unsigned int x,y;
  110. char str[];
  111. {
  112.     TEK40move(x,y-11);
  113.     fprintf(outfile,"\037%s\n",str);
  114. }
  115.  
  116.  
  117. TEK40reset()
  118. {
  119. }
  120.  
  121. #endif /* TEK */
  122.  
  123.  
  124.  
  125. /* thanks to dukecdu!evs (Ed Simpson) for the BBN BitGraph driver */
  126.  
  127. #ifdef BITGRAPH
  128.  
  129. #define BG_XMAX                 768 /* width of plot area */
  130. #define BG_YMAX                 768 /* height of plot area */
  131. #define BG_SCREEN_HEIGHT    1024 /* full screen height */
  132.  
  133. #define BG_XLAST     (BG_XMAX - 1)
  134. #define BG_YLAST     (BG_YMAX - 1)
  135.  
  136. #define BG_VCHAR    16
  137. #define BG_HCHAR     9
  138. #define BG_VTIC         8
  139. #define BG_HTIC         8    
  140.  
  141.  
  142. #define BG_init TEK40init
  143.  
  144. #define BG_graphics TEK40graphics
  145.  
  146.  
  147. #define BG_linetype TEK40linetype
  148.  
  149. #define BG_move TEK40move
  150.  
  151. #define BG_vector TEK40vector
  152.  
  153.  
  154. BG_text()
  155. {
  156.     BG_move(0, BG_SCREEN_HEIGHT - 2 * BG_VCHAR);
  157.     fprintf(outfile,"\037");
  158. /*                   1
  159.     1. into alphanumerics
  160. */
  161. }
  162.  
  163.  
  164. BG_put_text(x,y,str)
  165. unsigned int x,y;
  166. char str[];
  167. {
  168.     BG_move(x,y-11);
  169.     fprintf(outfile,"\037%s\n",str);
  170. }
  171.  
  172.  
  173. #define BG_reset TEK40reset
  174.  
  175. #endif /* BITGRAPH */
  176.  
  177.  
  178. /* Color and Monochrome specials for the MS-Kermit Tektronix Emulator
  179.    by Russell Lang,  eln272v@monu1.cc.monash.oz  */
  180.  
  181. #ifdef KERMIT
  182.  
  183. #define KTEK40HCHAR        13
  184.  
  185. KTEK40graphics()
  186. {
  187. #ifdef vms
  188.         term_mode_tek();
  189.     term_pasthru();
  190. #endif /* vms */
  191.     fprintf(outfile,"\033\014");
  192. /*                   1
  193.     1. clear screen
  194. */
  195.     /* kermit tektronix emulation doesn't need to wait */
  196. }
  197.  
  198. KTEK40Ctext()
  199. {
  200.     TEK40text();
  201.     KTEK40Clinetype(0);  /* change to green */
  202. #ifdef vms
  203.     term_nopasthru();
  204. #endif /* vms */
  205. }
  206.  
  207. /* special color linetypes for MS-DOS Kermit v2.31 tektronix emulator */
  208. /*    0 = normal, 1 = bright 
  209.     foreground color (30-37) = 30 + colors
  210.         where colors are   1=red, 2=green, 4=blue */
  211. static char *kermit_color[15]= {"\033[0;37m","\033[1;30m",
  212.         "\033[0;32m","\033[0;36m","\033[0;31m","\033[0;35m",
  213.         "\033[1;34m","\033[1;33m","\033[1;31m","\033[1;37m",
  214.         "\033[1;35m","\033[1;32m","\033[1;36m","\033[0;34m",
  215.         "\033[0;33m"};
  216.  
  217. KTEK40Clinetype(linetype)
  218. int linetype;
  219. {
  220.     if (linetype >= 13)
  221.         linetype %= 13;
  222.     fprintf(outfile,"%s",kermit_color[linetype+2]);
  223. }
  224.  
  225.  
  226. /* linetypes for MS-DOS Kermit v2.30 tektronix emulator */
  227. /* `=solid, a=fine dots, b=short dashes, c=dash dot, 
  228.    d=long dash dot, e=dash dot dot */
  229. static char *kerm_linetype = "`a`abcde" ;
  230.  
  231. KTEK40Mlinetype(linetype)
  232. int linetype;
  233. {
  234.     if (linetype >= 6)
  235.         linetype %= 6;
  236.     fprintf(outfile,"\033%c",kerm_linetype[linetype+2]);
  237. }
  238.  
  239. KTEK40reset()
  240. {
  241.     fprintf(outfile,"\030\n");  /* turn off Tek emulation */
  242. #ifdef vms
  243.     term_mode_native();
  244. #endif /* vms */
  245. }
  246.  
  247. #endif /* KERMIT */
  248.  
  249.  
  250. /* thanks to sask!macphed (Geoff Coleman and Ian Macphedran) for the
  251.    Selanar driver */
  252.  
  253. #ifdef SELANAR
  254.  
  255. SEL_init()
  256. {
  257.     fprintf(outfile,"\033\062");
  258. /*                    1
  259.     1. set to ansi mode
  260. */
  261. }
  262.  
  263.  
  264. SEL_graphics()
  265. {
  266.     fprintf(outfile,"\033[H\033[J\033\061\033\014");
  267. /*                   1           2       3
  268.     1. clear ANSI screen
  269.     2. set to TEK mode
  270.     3. clear screen
  271. */
  272. }
  273.  
  274.  
  275. SEL_text()
  276. {
  277.     TEK40move(0,12);
  278.     fprintf(outfile,"\033\062");
  279. /*                   1
  280.     1. into ANSI mode
  281. */
  282. }
  283.  
  284. SEL_reset()
  285. {
  286.     fprintf(outfile,"\033\061\033\012\033\062\033[H\033[J");
  287. /*                   1        2       3      4
  288. 1       set tek mode
  289. 2       clear screen
  290. 3       set ansi mode
  291. 4       clear screen
  292. */
  293. }
  294. #endif /* SELANAR */
  295.  
  296. #ifdef VTTEK
  297.  
  298. VTTEK40init()
  299. {
  300.         fprintf(outfile,"\033[?38h");
  301.         fflush(outfile);
  302.         sleep(1);
  303.         /* sleep 1 second to allow screen time to clear on some terminals */
  304. #ifdef vms
  305.         term_mode_tek();
  306. #endif /* vms */
  307. }
  308.  
  309. VTTEK40reset()
  310. {
  311.         fprintf(outfile,"\033[?38l");
  312.         fflush(outfile);
  313.         sleep(1);
  314.         /* sleep 1 second to allow screen time to clear on some terminals */
  315. #ifdef vms
  316.         term_mode_native();
  317. #endif /* vms */
  318. }
  319.  
  320. /* linetypes for VT-type terminals in tektronix emulator mode */
  321. /* `=solid, a=fine dots, b=short dashes, c=dash dot,
  322.    d=long dash dot, h=bold solid, i=bold fine dots, j=bold short dashes,
  323.    k=bold dash dot, l=bold long dash dot */
  324. static char *vt_linetype = "`a`abcdhijkl" ;
  325. static int last_vt_linetype = 0;
  326. VTTEK40linetype(linetype)
  327. int linetype;
  328. {
  329.         if (linetype >= 10)
  330.                 linetype %= 10;
  331.         fprintf(outfile,"\033%c",vt_linetype[linetype+2]);
  332.         last_vt_linetype = linetype;
  333. }
  334.  
  335. VTTEK40put_text(x,y,str)
  336. unsigned int x,y;
  337. char str[];
  338. {
  339.         int linetype;
  340.         linetype = last_vt_linetype;
  341.         VTTEK40linetype(0);
  342.         TEK40put_text(x,y,str);
  343.         VTTEK40linetype(linetype);
  344. }
  345.  
  346. #endif /* VTTEK */
  347.  
  348. #ifdef LN03P
  349.  
  350. LN03Pinit()
  351. {
  352.     fprintf(outfile,"\033[?38h");
  353. }
  354.  
  355. LN03Preset()
  356. {
  357.     fprintf(outfile,"\033[?38l");
  358. }
  359. #endif LN03P
  360.